<?php

declare(strict_types=1);
/**
 * This file is part of MineAdmin.
 *
 * @link     https://www.mineadmin.com
 * @document https://doc.mineadmin.com
 * @contact  root@imoi.cn
 * @license  https://github.com/mineadmin/MineAdmin/blob/master/LICENSE
 */

namespace App\Http\Admin\Request\Question;

use App\Schema\Question\QuestionSchema;
use Hyperf\Validation\Request\FormRequest;
use Mine\Swagger\Attributes\FormRequest as FormRequestAnnotation;

#[FormRequestAnnotation(
    schema: QuestionSchema::class,
    title: '创建题库',
    required: [
        'title',
        'group',
        'level',
        'answers',
        'analysis',
    ],
    only: [
        'title',
        'group',
        'level',
        'answers',
        'analysis',
    ]
)]
class QuestionRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'title'=>'required|string',
            'level'=>'required|integer',
            'answers'=>'required|array',
            'type' => 'required|string',
            'group_id' => 'integer'
            // 'analysis'=>'required|array',
        ];
    }

    public function attributes(): array
    {
        return [
            'title'=>trans('question.title'),
            'level'=>trans('question.level'),
            'answers'=>trans('question.answers'),
            'type'=>trans('question.type'),
            'group_id' => trans('question.group_id'),
            // 'analysis'=>trans('question.analysis'),
            
        ];
    }
}
